import os
from tkinter import Image

from selenium.webdriver.common.by import By
import time
from Comm.Driver import gdriver


class CodeIng:
    def __init__(self):
        gdriver.get("http://172.21.163.193:8080/List")

        # 所有题目
        question_links = gdriver.find_elements(mode=By.XPATH, key='//td[@class="item"]/a')
        i = 1
        for link in question_links:
            gdriver.click(link)
            gdriver.save_screenshot("../Images/Details/" + str(i) + ".png")
            gdriver.click(gdriver.find_element("body > div > div.part2 > button"))
            time.sleep(2)
            gdriver.save_screenshot("../Images/Details/" + str(i) + "测试提交" + ".png")
            gdriver.back()
            i += 1